#ifndef _KERNELSINSERTION_H
#define _KERNELSINSERTION_H



bool CPUInitGPUEnv(int device_number);
void CPUdevice_memset(unsigned int* sorted_index, unsigned int ass_value, int length, int offset = 0);
void CPUdevice_memsetf(float* sorted_index, float ass_value, int length, int offset = 0);
void CPUbinarySearch(float *sorted_data,int sorted_data_length, float *batch_data,int batch_data_length,unsigned int* sorted_index, unsigned int *batch_index);
void CPUbinarySearchTextured( float *sorted_data,int sorted_data_length, float *batch_data,int batch_data_length,unsigned int* sorted_index, unsigned int *batch_index);
void CPUparySearch(float *sorted_data, int sorted_data_length, float *batch_data,int batch_data_length, unsigned int* sorted_index, unsigned int *batch_index);
void CPUplus_index(int length, unsigned int *input_array, int batch_size);
void CPUbitonicMerge(int grid, float *sorted_data, float *batch_data, float *result, unsigned int *smallSegNum, unsigned int* smallBkIndex, unsigned int *combinedWriteBack);
void CPUGPUAddTo(unsigned int *dst, unsigned int *src);
void CPUpadSmallArray(unsigned int *smallSegNum, unsigned int *smallBkIndex, float *paddedSmallArray, unsigned int *smallBkSize, float *smallArray, int *smallBoundaries, int bitonicSeg);
void CPUsplitAssist(float *smallArray, int *smallBoundaries, unsigned int *smallSegNum, unsigned int *combinedSize, unsigned int *smallBkSize, int bitonicSeg);
void CPUlbsSplitAssist(float *smallArray, int *smallBoundaries, unsigned int *combinedSize, unsigned int *smallBkSize, int bitonicSeg);
void CPUbinarySplit(float *largeArray, int largeArrayLength, float *smallArray, int smallArrayLength, int *smallBoundaries, int bitonicSeg, int segSpan);
void CPUlocalBinarySearch( unsigned int *smallBkSize, unsigned int *bkSizePrefixsum, unsigned int *combinedWriteBack, float *largeArray, float *smallArray, float *result, int bitonicSeg);
void CPUdelScatter(float *src, float *dst, unsigned int *index, int srcLen);

#endif